package com.www.applyword.utils;

import android.text.TextUtils;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.www.applyword.Constants.Constants;
import com.www.applyword.R;

/**
 * author : huang
 * date   : 2019/10/29 0029 17:43
 * version: 1.0
 */
public class ImageUtil {

    public static void setImage(ImageView imageView, String url) {
        RequestOptions options = new RequestOptions().placeholder(R.mipmap.head);
        if (!TextUtils.isEmpty(url) && url.contains("http")){
                Glide.with(imageView.getContext()).load(url).apply(options)
                        .into(imageView);
        }else {
            Glide.with(imageView.getContext()).load(Constants.HOST + url).apply(options)
                    .into(imageView);
        }
    }
}
